package com.lb.jwitter.util;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.lb.jwitter.service.TblThongTinNhomLopMonHoc;
import com.lb.jwitter.service.TblThongTinTKBChiTiet;

public class ThoiKhoaBieuDuKien {
	private TblThongTinNhomLopMonHoc nhomLop;
	private List<TblThongTinTKBChiTiet> chiTiets;
	private String tuanHocs;
	public String getTuanHocs(TblThongTinTKBChiTiet chiTiet) {
		if(chiTiet != null && chiTiet.getTuanHoc() != null){
	        //tuanHocs = Arrays.asList(Integer.toBinaryString(tblThongTinTKB.getTuanHoc()).split("(?!^)"));
			tuanHocs = Integer.toBinaryString(chiTiet.getTuanHoc());
        }else{
        	if(nhomLop != null && nhomLop.getTKBId() != null && nhomLop.getTKBId().getTuanHoc() !=null){
        		tuanHocs = Integer.toBinaryString(nhomLop.getTKBId().getTuanHoc());
        	}
        }
        if(tuanHocs.length() < 26){
        	while(tuanHocs.length()<26){
        		tuanHocs = "0" + tuanHocs;
        	}
        }
        String th = "";
        for(int i =0; i < tuanHocs.length(); i++){
        	if(tuanHocs.charAt(i)== '1'){
        		th += (i+1)%10;
        	}else{
        		th += "-";
        	}
        }
		return th;
	}
	public void setTuanHocs(String tuanHocs) {
		this.tuanHocs = tuanHocs;
	}
	public List<TblThongTinTKBChiTiet> getChiTiets() {
		return chiTiets;
	}
	public void setChiTiets(List<TblThongTinTKBChiTiet> chiTiets) {
		this.chiTiets = chiTiets;
	}
	public TblThongTinNhomLopMonHoc getNhomLop() {
		return nhomLop;
	}
	public void setNhomLop(TblThongTinNhomLopMonHoc nhomLop) {
		this.nhomLop = nhomLop;
	}

}
